import http from "../request.js";
const header = {
	"Content-Type": "application/x-www-form-urlencoded"
};

class NftWallet {
	constructor() {
		this.getNftListApi = "/api/nft/getNfts"
		this.getNftDetailApi = "/api/nft/details"
		this.saveNftWalletApi = "/api/nft/saveSk"
		this.getUserWalletApi = "/api/nft/getSk"
		this.validateWalletPasswordApi = "/api/nft/checkSk"
		this.donationApi = "/api/nft/transfer"
		this.decryptApi = "/api/nft/decrypt"
		this.updateMintStatusApi = "/api/nft/updateMintStatus"
		this.nftMintApi = "/api/nft/mint"
		this.getGasPriceApi = "/api/nft/getGasPrice"
    this.receiveNftApi = "/api/nft/receiveNft"
	}
	getNftList(data) {
		return http.post(this.getNftListApi, data, {
			header
		}).then((res) => res.data);
	}
	getNftDetail(nft_id,type) {
		return http.post(this.getNftDetailApi, {
			nft_id,
      type
		}, {
			header
		}).then((res) => res.data);
	}
	saveNftWallet(data) {
		return http.post(this.saveNftWalletApi, data, {
			header
		}).then((res) => res.data);
	}
	getUserWallet() {
		return http.post(this.getUserWalletApi, null, {
			header
		}).then((res) => res.data);
	}
	validateWalletPassword(data) {
		return http.post(this.validateWalletPasswordApi, data, {
			header
		}).then((res) => res.data);
	}
	donation(data) {
		return http.post(this.donationApi, data, {
			header
		}).then((res) => res.data);
	}
	decrypt(data) {
		return http.post(this.decryptApi, data, {
			header
		}).then((res) => res.data);
	}
	updateMintStatus(nft_ids,hashs,type){
		return http.post(this.updateMintStatusApi, {nft_ids,hashs,type}, {
			header
		}).then((res) => res.data);
	}
	nftMint(nft_id,type){
		return http.post(this.nftMintApi, {nft_id,type}, {
			header
		}).then((res) => res.data);
	}
	getGasPrice(){
		return http.post(this.getGasPriceApi, null, {
			header
		}).then((res) => res.data);
	}
  receiveNft(data){
    return http.post(this.receiveNftApi, data, {
			header
		}).then((res) => res.data);
  }
}
export const NftWalletApi = new NftWallet();